Language Translations

Saturday, February 25, 2023

9:01 AM

OneMore is release in at least 10 languages. English defaults are applied to dialogs and UI components with all resource strings specified in Resources.resx.

 

📓

What to do

If you want a new language to be added, it must be done using the ResxTranslator application to create a base language file, such as Resources.ja-JP.resx. Once that is done and part of the build, that can then be overriden by a targeted Resources.ja-JP-hints.resx file as explained below.

 

If you want specific updates to existing translated strings, do not update resource files directly. Instead, follow the instructions below to create or update an appropriate hints file containing specific string overrides.

 

All translations are performed using my ResxTranslator application which is a tool that automates translations into multiple languages, generating ISO code tagged resource files using GTranslate. The GTranslate package relies on a host of online translation services, including Google, Microsoft, and Bing. While these services are generally quite good, there are nuances in languages and context that they can't predict and may make a native speaker question the appropriateness of the translation.

 

ResxTanslator includes a mechanism to override inaccuracies without interfering with the subsequent regeneration of resource files. For each language, you can provide an optional hint file that contains preferred translations for each resource identifier. This must be an XML file located in the same directory as the source resx file and must be named name.code-hints.xml, for example Resources.de-DE-hints.xml.

 

When resources are translated to that language, ResxTranslator will first look for each resource identifier in this hint file and use the available text before attempting to use GTranslate.

 

The contents of the hints file should look similar to the following:

 

<?xml version="1.0" encoding="utf-8"?>

<hints>

  <hint name="resouce-identifier1">

    <source>

      copy of the source text from the main resx file

    </source>

    <preferred>

      my preferred translation here

    </preferred>

  </hint>

  <hint name="resouce-identifier2">

    <source>

      copy of the source text from the main resx file

    </source>

    <preferred>

      my preferred translation here

    </preferred>

  </hint>

</hints>

 

The form of each <hint> element is as follows.

 

  • The name attribute must match the resource identifier of one string in the corresponding resx file.
  • The source element must match the English string value of the resource. This is used to detect hints that have become stale and no longer match updated resources.
  • The preferred element contains the override for this resource

 

To submit changes to the OneMore project, either a) open a pull request with updates to the hints file or b) create a new issue and attach the updated hints file.

 

 

#omwiki #omdeveloper

 

© 2020 Steven M Cohn. All rights reserved.

Please consider a sponsorship or one-time donation to support ongoing development

 

 

Created with OneNote.